package com.hjl.config;

import io.minio.MinioClient;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ServivE
 * @version 0.1
 * @className MinioConfig
 * @description
 * @date 2024/11/18 20:54
 * @since jdk17
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "minio.config")
public class MinioConfig {
    /**
     * 服务地址
     */
    private String url;
    /**
     * 用户名
     */
    private String accessKey;

    /**
     * 密码
     */
    private String secretKey;
    /**
     * 存储桶名称
     */
    private String bucketName;

    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
    }



}
